#include <aphw/Utils.hpp>

#include <boost/python.hpp>

using namespace boost::python;

namespace aphw {

std::vector<ham_parameter_t>
constructParams(dict params)
{
    std::vector<ham_parameter_t> paramvec;
    list items = params.items();
    boost::python::ssize_t numItems = len(items);

    for (boost::python::ssize_t itemIdx = 0; itemIdx < numItems; ++itemIdx)
    {
        tuple tup = extract<tuple>(items[itemIdx]);

        ham_parameter_t paramValue;
        paramValue.name = extract<ham_u32_t>(tup[0]);
        paramValue.value = extract<ham_u64_t>(tup[1]);
        paramvec.push_back(paramValue);
    }

    ham_parameter_t paramValue = { 0, 0 };
    paramvec.push_back(paramValue);

    return paramvec;
}

}
